<script setup>
import { onMounted, ref } from 'vue'
import { ElConfigProvider } from 'element-plus'
import { elMessage } from '@/uc-element-plus/ele-message.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import SetIp from '@/views/component/SetIp.vue'
import isOnline from 'is-online'
import mitt from '@/mitt'
const isClient = window.electronAPI || window.__TAURI__
const isShow = ref(false)
const checkNet = async () => {
  const online = await isOnline()
  if (!online) {
    elMessage({
      type: 'error',
      title: '温馨提示',
      message: '网络异常，请检查网络状态...'
    })
  }
}
onMounted(() => {
  if (isClient) {
    mitt.on('set-ip', (tag = true) => {
      isShow.value = tag
    })
  }
})
</script>

<template>
  <el-config-provider :locale="zhCn">
    <set-ip v-if="isClient && isShow"></set-ip>
    <router-view></router-view>
  </el-config-provider>
</template>
